<template>
  <div class="error-monitor">

    <div>
      <h3 class="title">白屏页面</h3>
      <el-table
          :data="whiteScreenList"
          border
          style="width: 100%">
        <el-table-column
            prop="name"
            label="页面名称"
            width="200">
        </el-table-column>
        <el-table-column
            prop="path"
            label="页面路径">
        </el-table-column>
        <el-table-column
            prop="duration"
            label="白屏时长">
        </el-table-column>
        <el-table-column
            prop="createdTime"
            label="发生时间" width="200px">
        </el-table-column>
      </el-table>
    </div>

    <div style="margin-top: 40px">
      <h3 class="title">页面报错</h3>

      <el-table
          :data="errorPageList"
          border
          style="width: 100%">
        <el-table-column
            prop="name"
            label="页面名称"
            width="200">
        </el-table-column>
        <el-table-column
            prop="component"
            label="组件">
        </el-table-column>
        <el-table-column
            prop="path"
            label="页面路径">
        </el-table-column>
        <el-table-column
            prop="message"
            label="错误">
        </el-table-column>
        <el-table-column
            prop="stack"
            type="expand"
            width="200px"
            label="堆栈">
          <template slot-scope="props">
            <div>
              {{props.row.stack}}
            </div>
          </template>
        </el-table-column>
        <el-table-column
            prop="row"
            label="行号">
        </el-table-column>
        <el-table-column
            prop="col"
            label="列号">
        </el-table-column>
        <el-table-column
            prop="createdAt"
            label="发生时间" width="200px">
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script>
import ErrorMonitorService from "@/services/ErrorMonitorService";

export default {
  name: "ErrorMonitor",
  data() {
    return {
      whiteScreenList: [],
      errorPageList: []
    }
  },

  created() {

  },

  mounted() {
    this.getErrorList();
  },

  methods: {
    getErrorList() {
      ErrorMonitorService.getErrorList().then(res => {
        this.errorPageList = res;
      })
    }
  },

}
</script>

<style lang="scss" scoped>
.error-monitor {
  padding: 40px;
  .title {
    line-height: 2;
  }
}
</style>
